import axios from '../utils/request'
import store from './index'
const account = {
  spacename: true,
    state: {
      actorlist:[],
      sicklist:[]
    },
    mutations: {
      //初始化医生列表
      setactorlist(state,obj){
        state.actorlist=obj
      },
      //初始化患者列表
      setsicklist(state,obj){
        state.sicklist=obj
      },
      //删除医生列表数据
      delete_actor(state,payload){
        console.log(payload.serial)
        const arr=state.actorlist.filter((item,index)=>{
          return item.serial!==payload.serial
        })
        state.actorlist=arr
      },
      //删除患者
      delete_sick(state,payload){
        const arr=state.sicklist.filter((item,index)=>{
          return item.serial!==payload.serial
        })
        state.sicklist=arr
      }
    },
    actions: {
      get_Data(){
        axios.get("/api/getdata").then(res=>{
          // console.log(res.data.auditlis)
          store.commit('setactorlist',res.data.actorlist)
          store.commit('setsicklist',res.data.sicklist)
        })
      }
    },
  }
  export default account